{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1.python基础试题"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.1 python 中boolean、float 和 int 分别表示什么？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.2  设计求1-2+3-4+5 ... 99的所有数的和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "50\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.3  将字符串 s=\"yoyo\" 转换成列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['y', 'o', 'y', 'o']"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2. python进阶基础试题"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.1     for i in range(1,100)[2::3][-10:]: \n",
    "\n",
    "                print i \n",
    "                \n",
    "        理解这段代码，并说出它是如何取数的"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.2 使用init 实例化时自动运行  分别计算单只股票最高价和收盘价两个时间点差值问题,可统一为one、two两个时间点,其最高价和收盘价赋值为 one(15,7) two(66,20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'one_dif': 8}\n",
      "{'two_dif': 46}\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3. pandas数据处理试题"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.1 如何查看列名、怎么对数据转置"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.2 读取data里的600029这只股票的DataFrame,将其收盘价转换成用Numpy的Array格式，并用talib计算10日EMA值，返回ndarray的最后五个值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'numpy.ndarray'>\n",
      "[ 15.08227205  15.2564044   15.44433088  15.72172526  15.96322976]\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.3 读取sz50.xlsx的['600029.XSHG','600050.XSHG','601318.XSHG']的全数据做成Panel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<class 'pandas.core.panel.Panel'>\n",
       "Dimensions: 3 (items) x 215 (major_axis) x 5 (minor_axis)\n",
       "Items axis: 600029.XSHG to 601318.XSHG\n",
       "Major_axis axis: 2017-01-03 15:00:00 to 2017-11-20 15:00:00\n",
       "Minor_axis axis: close to volume"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.4把Panel转成ndim为3的Numpy，然后用array的切片读取ndim为2的三只股票最近20天的收盘价"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(3, 215, 5)\n",
      "[[  13.85   13.82   13.83   14.11   14.25   14.39   15.1    15.15   15.22\n",
      "    14.97   14.89   14.99   14.71   15.07   15.35   16.     16.04   16.29\n",
      "    16.97   17.05]\n",
      " [   8.53    8.56    8.62    8.88    9.25    9.24    9.43    9.25    9.02\n",
      "     9.15    9.63    9.5     9.9     9.97    9.96    9.49    9.68    9.61\n",
      "     9.63    9.8 ]\n",
      " [ 134.83  134.56  137.5   143.18  143.48  144.15  143.61  143.65  144.35\n",
      "   143.36  146.41  144.71  148.56  156.53  157.12  157.72  154.99  163.52\n",
      "   168.58  169.57]]\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.5 建立一个5*5的矩阵，值从0到24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0  1  2  3  4]\n",
      " [ 5  6  7  8  9]\n",
      " [10 11 12 13 14]\n",
      " [15 16 17 18 19]\n",
      " [20 21 22 23 24]]\n"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
